package com.petAdoption.manager.service.impl;

import com.petAdoption.manager.entity.Petbreed;
import com.petAdoption.manager.entity.Pettype;
import com.petAdoption.manager.mapper.PettypeMapper;
import com.petAdoption.manager.service.IPettypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 王倩茹
 * @since 2023-08-28
 */
@Service
public class PettypeServiceImpl extends ServiceImpl<PettypeMapper, Pettype> implements IPettypeService {

    @Resource
    private PettypeMapper pettypeMapper;
    @Override
    public List<Pettype> findAll() {
        return pettypeMapper.selectList(null);
    }

    @Override
    public int delPetType(Integer pettypeId) {
        return pettypeMapper.deleteById(pettypeId);
    }

    @Override
    public int addPetType(Pettype pettype) {
        return pettypeMapper.insert(pettype);
    }

    @Override
    public int updatePetType(Pettype pettype) {
        return pettypeMapper.updateById(pettype);
    }


//
//    @Override
//    public Pettype findByName(String petName) {
//        QueryWrapper<Pettype> queryWrapper = new QueryWrapper<>();
//        queryWrapper.eq("petType_name",petName);
//        Pettype pettype = pettypeMapper.selectOne(queryWrapper);
//        return pettype;
//    }
//
//    @Override
//    public int deletePetType(Integer pettypeId) {
//        QueryWrapper<Pettype> queryWrapper = new QueryWrapper<>();
//        queryWrapper.eq("petType_id",pettypeId);
//        int pettype = pettypeMapper.deleteById(queryWrapper);
//        return pettype;
//    }
//
//    @Override
//    public List<Pettype> findPetTypeAll(Pettype pettype) {
//        return  pettypeMapper.selectList(null);
//    }
//
//    @Override
//    public int updatePetType(Pettype pettypeId) {
//        QueryWrapper<Pettype> queryWrapper = new QueryWrapper<>();
//        queryWrapper.eq("PetType_id",pettypeId);
//        int rows = pettypeMapper.updateById(pettypeId);
//        return rows;
//    }
//
//    @Override
//    public int addPetType(Pettype pettype) {
//        QueryWrapper<Pettype> queryWrapper = new QueryWrapper<>();
//        queryWrapper.eq("PetType",pettype);
//        int rows = pettypeMapper.insert(pettype);
//        return rows;
//    }


}
